Skip to content

reimpl/BuildingsState - #234

Draft
gynt wants to merge 286 commits into
mainfrom
reimpl/BuildingsState
Draft

gynt wants to merge 286 commits into
mainfrom
reimpl/BuildingsState

Conversation

@gynt

@gynt gynt commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

No description provided.

gynt added 30 commits September 24, 2026 07:14
gynt and others added 12 commits November 8, 2026 18:42
…p files

The branch-only BuildingsState files get the readability pass the guide asks
for: redundant casts dropped, int const on assign-once locals, BOOLEnum for
proven 0/1 flags, enum and logic-flag names and countof() for magic numbers,
loops instead of do/while and pointer walks where neutral, early returns and
if/else instead of ternaries. Every change was measured per file
(quick_diff / quick_gl, plain and with stack slots) and reccmp is unchanged
for all 165 functions (avg 99.86). Forms that measured worse stay as they
were, with a Matching note recording what was tried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmagorvAnNswXbnfKuE
gynt and others added 6 commits December 3, 2026 23:09
The 19 BuildingsState .cpp files main already has at 100% take main's
version (add/add conflicts resolved to origin/main), and lightUpBuilding is
restored to main's, so the PR no longer changes them. Tool conflicts
(README.md, quick_gl.py) resolved to main's.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
determineBuildingEntranceFromCustomArea returns BuildingEntranceSearchResult
and setupBuildingData takes an int averageHeight in main's header.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Re-measured with a full build after merging origin/main (both resolver sets
enabled). The source is unchanged apart from the averageHeight type; MSVC now
keeps the address of buildings[buildingID].uid in a stack temporary and still
emits the outpost case inline where the original places it after the return.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
The drop from 93.0% to 71.7% after the merge with main bisects to main's
02e7895 (upstream ghidra changes), which adds M_MAPPER_UNKNOWN_248..264
to MappersEnum.hpp. The code itself is untouched: the extra enumerators
shift MSVC's internal symbol numbering, which changes which field
addresses get CSE'd (reverting only those 17 enumerators restores the
old code; a 17-value dummy enum re-breaks it). Under the new numbering
countof(this->buildings) as the slot-search bound and reading the
cesspit x through a reference give the original's temporaries back
(quick_diff 0.8025 -> 0.9816). Build mode: plain (not /GL).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…d (reccmp symbol artefact)

The code is byte-identical to the original. reccmp scores it 94.7% only because
the loop end immediate (end of the 110-entry cost table, 0x5C2A6C) is symbolized
differently on each side:
  -cmp eax, I<OpenSHC::Game::RenderingDefinedData>::instance (DATA)
  +cmp eax, FunctionResolver::AddressUsageKeeper<4234672>::initialized (DATA)
quick_diff.py shows no instruction difference besides the alignment pad
(jmp + lea in the original, npad in our listing). Recorded as 100.0% following
main's precedent for 0x004E12C0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
gynt and others added 2 commits December 5, 2026 05:49
…iveBack remark

Measured with a full build and reccmp, both resolver sets on.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant